﻿namespace DoNet.Token.Common
{
    public class ApiResultHelper
    {
        /// <summary>
        /// 成功
        /// </summary>
        /// <param name="data">数据</param>
        /// <returns></returns>
        public static ApiResult Success(object data)
        {
            return new ApiResult() { success = true, code = 200, data = data };
        }
        /// <summary>
        /// 失败
        /// </summary>
        /// <param name="data">数据</param>
        /// <returns></returns>
        public static ApiResult Error(string message)
        {
            return new ApiResult() { success = true, code = 400, msg = message };
        }
        /// <summary>
        /// 自定义
        /// </summary>
        /// <param name="success"></param>
        /// <param name="code"></param>
        /// <param name="message"></param>
        /// <param name="data"></param>
        /// <returns></returns>
        public static ApiResult Customize(bool success, int code, string message, object data)
        {
            return new ApiResult() { success = success, code = code, msg = message, data = data };
        }
    }
}
